package com.xiaoyu.lanling.feature.videomatch.log

import com.xiaoyu.lanling.common.UTEvent
import com.xiaoyu.lanling.feature.videomatch.datamodel.EvaluateEnum
import com.xiaoyu.lanling.util.event
import com.xiaoyu.lanling.util.logEvent
import com.xiaoyu.lanling.util.prop

class VideoMatchLogger {
    companion object {

        fun logVideoMatchClick(from: String, openStatus: String, isCalling: Boolean) {
            event(UTEvent.VideoMatch.MATCH_CLICK)
                    .prop("from", from)
                    .prop("open_status", openStatus)
                    .prop("is_calling", isCalling)
                    .logEvent()
        }

        fun logVideoMatchStart() {
            event(UTEvent.VideoMatch.MATCH_REQUEST_START)
                    .logEvent()
        }

        fun logVideoMatchExitBeforeMatch() {
            event(UTEvent.VideoMatch.MATCH_EXIT_BEFORE_MATCH).logEvent()
        }

        fun logVideoMatchExitStart(waitTime: Long, reason: String) {
            event(UTEvent.VideoMatch.MATCH_EXIT_START)
                    .prop("wait_time", waitTime)
                    .prop("reason", reason)
                    .logEvent()
        }

        fun logVideoMatchExitSuccess() {
            event(UTEvent.VideoMatch.MATCH_EXIT_REQUEST_SUCCESS).logEvent()
        }

        fun logVideoMatchExitFailed() {
            event(UTEvent.VideoMatch.MATCH_EXIT_REQUEST_FAILED).logEvent()
        }

        fun logVideoMatchCallStart() {
            event(UTEvent.VideoMatch.CALL_START).logEvent()
        }

        fun logVideoMatchCallSucceed() {
            event(UTEvent.VideoMatch.CALL_SUCCEED).logEvent()
        }

        fun logVideoMatchCallFailed(reason: String) {
            event(UTEvent.VideoMatch.CALL_FAILED)
                    .prop("reason", reason)
                    .logEvent()
        }

        fun logVideoMatchCallConnected() {
            event(UTEvent.VideoMatch.CALL_CONNECTED).logEvent()
        }

        fun logVideoMatchCallRequestHangUp(totalTime: Long, reason: String, type: String) {
            event(UTEvent.VideoMatch.CALL_HANG_UP_REQUEST_START)
                    .prop("reason", reason)
                    .prop("total_time", totalTime)
                    .prop("type", type)
                    .logEvent()
        }

        fun disableVideo() {
            event("video_match_disable_video")
                    .logEvent()
        }

        fun enableVideo(duration: Long) {
            event("video_match_enable_video")
                    .prop("duration", duration)
                    .logEvent()
        }

        /*evaluate*/
        fun logEvaluateDialogShow() {
            event(UTEvent.VideoMatch.EVALUATE_SHOW)
                    .logEvent()
        }

        fun logEvaluateStart(type: EvaluateEnum) {
            event(UTEvent.VideoMatch.EVALUATE_START)
                    .prop("evaluate", type.type)
                    .logEvent()
        }

        fun logEvaluateDialogClose() {
            event(UTEvent.VideoMatch.EVALUATE_CLOSE)
                    .logEvent()
        }
    }
}